package com.dinzeer.balmung.data;


import com.dinzeer.balmung.Balmung;
import com.dinzeer.balmung.register.SaRegsitry;
import mods.flammpfeil.slashblade.item.SwordType;
import mods.flammpfeil.slashblade.registry.SpecialEffectsRegistry;
import mods.flammpfeil.slashblade.registry.slashblade.EnchantmentDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.PropertiesDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.RenderDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.SlashBladeDefinition;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.List;

public class BABuiltInRegsitry {

    public static final ResourceKey<SlashBladeDefinition> BALMUNG = register("balmung");
    public static void registerAll(BootstapContext<SlashBladeDefinition> bootstrap) {

        bootstrap.register(
                BALMUNG, new SlashBladeDefinition(Balmung.prefix("balmung"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Balmung.prefix("model/balmung/balmung.png"))
                                .modelName(Balmung.prefix("model/balmung/balmung.obj"))
                                .effectColor(65318)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .baseAttackModifier(7)
                                .slashArtsType(SaRegsitry.BalmungSa.getId())
                                .maxDamage(200)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS),5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS),5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING),3)
                        )
                ));
    }


    private static ResourceKey<SlashBladeDefinition> register(String id) {
        return ResourceKey.create(SlashBladeDefinition.REGISTRY_KEY, Balmung.prefix(id));
    }
    static ResourceLocation getEnchantmentID(Enchantment enchantment) {
        return ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
    }

}
